package com.baijia.authentication;

public enum OrgType {

    MAIN(1, "主账号"), SUB(2, "子账号");

    private int code;
    private String name;

    OrgType(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {

        return code;
    }

    public void setCode(int code) {

        this.code = code;
    }

    public String getName() {

        return name;
    }

    public void setName(String name) {

        this.name = name;
    }

    public static OrgType getOrgTypeByCode(Integer code) {
        for (OrgType orgType : OrgType.values()) {
            if (orgType.getCode() == code) {
                return orgType;
            }
        }

        return null;
    }

}